// 仿照C#里面的RegExp.matches
RegExp.matches = function (input, pattern) {
    if ('string' !== typeof input || 'string' !== typeof pattern) {
        throw new Error('调用参数必须都是字符串！');
    }
    var regexp = new RegExp(pattern, 'g'),
        matches = [], match, result;
    while ((result = regexp.exec(input)) != null) {
        match = {
            groups: [],
            index: result.index,
            Value: result[0]
        };
        // 如果长度大于一，说明有分组
        if (result.length > 1) { match.groups = result.slice(1); }
        // 存入结果
        matches.push(match);
    }
    return matches;
}